'''
Created on Nov 9, 2009

@author: mkiyer
'''
import numpy as np

class Transcript(object):
    id_prefix = 'transcript'
    id_count = 0
    
    @staticmethod
    def __get_id():
        id = Transcript.id_prefix + str(Transcript.id_count)
        Transcript.id_count += 1
        return id
    
    def __init__(self, chrom, start, end, strand):
        self.id = self.__get_id()        
        self.chrom = chrom
        self.start = start
        self.end = end
        self.strand = strand
        self.library_ids = []
        self.covs = []
        self.p_value = 1.0

    def __str__(self):
        return '\t'.join([self.chrom,
                          str(self.start),
                          str(self.end),
                          self.id,
                          '%.5f' % (-np.log(self.p_value)),
                          '.' if self.strand is None else self.strand,
                          str(len(self.library_ids)),
                          ','.join(self.library_ids),
                          ','.join(map(str, self.covs))])